package selenium;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class test2{

    public static void main(String[] args) {

    	WebDriver driver = new ChromeDriver();
        try{
            driver.get("https://kyfw.12306.cn/otn/index/init");            
            JavascriptExecutor driver_js= (JavascriptExecutor) driver;
            
            //输入出发地
            driver_js.executeScript("arguments[0].value=\"杭州\"",driver.findElement(By.id("fromStationText")));
        //  driver_js.executeScript("document.getElementById(\"fromStationText\").value=\"广州\"");
            
            //输入目的地
            driver_js.executeScript("arguments[0].value=\"深圳\"",driver.findElement(By.id("toStationText")));
            
            //输入出发时间
            driver_js.executeScript("arguments[0].value=\"2017-10-20\"",driver.findElement(By.id("train_date")));
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}